<!DOCTYPE html> 
<html> 
<head>
<style type="text/css">
body,td,th {
	font-size: 2em;
}
</style> 
　<title>FastFruit Store</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet" href="css/jquery.mobile-1.4.2.min.css" />
<link rel="stylesheet" type="text/css" href="css/jkcss.css">
<link rel="stylesheet" type="text/css" href="css/jquery-ui.min.css">
<script type="text/javascript" src="js/lib/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="js/JKLogin.js"></script>
<script type="text/javascript" src="js/JKCheckForm.js"></script>
<script type="text/javascript" src="js/JKFunc.js"></script>
<script type="text/javascript" src="js/JKRegister.js"></script>
<script type="text/javascript" src="js/lib/jquery.mobile-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
<script type="text/javascript">

window.onload = function(){
var isAutoLogin =  "false";
var availableTags = "";
if(localStorage.getItem("telPhones")!=null){
availableTags = localStorage.getItem("telPhones").split(",");
}
isAutoLogin = localStorage.getItem("isAutoLogin");
if(isAutoLogin=="true"){
	var shopId = localStorage.getItem("shopid");
	var loginAuthority =localStorage.getItem("loginAuthority");	
	if(shopId && shopId!=null){
		if("undefined" != typeof (mobile)){
			mobile.login(localStorage.getItem("LoginName"));
		}
		top.location=loginAuthority+".html";
	}
	}
	
	//$( "#phone_number13" ).autocomplete({
//	source: availableTags
//});
$("#phone_number13").autocomplete({
              autoFocus: false,
            source:availableTags,
            minLength: 0,
            }).focus(function () {
                $(this).autocomplete("search");
            });
}


</script>

</head> 
<body>
<!--登陆页面  panel 1.3-->
<div id="page_1_3" data-role="page" data-theme="jk">
	<div data-role="header">
    	<h1 class="ui-corner-all">商家登陆</h1>
    </div>
    <div data-role="content">
    
    	<div class="ui-field-contain">
    	  <h4>手机号：</h4>
      <input type="text" name="phone_number13" id="phone_number13" placeholder="手机号" >
             <h4>密码：</h4>
      <input type="password" name="password" id="password" placeholder="密码" value=""></div>
        <br>
        <div>
            <input type="checkbox" name="auto13" id="auto13" onClick="setAutoLogin()" >
            <label for="auto13" style="background-color:#55c3f1;border-radius: 10px;">自动登录</label>
        </div>
        <div class="ui-grid-a"> 
            <div class="ui-block-a">
                <input type="radio" name="login_choose" id="main" value="1" checked>
                <label for="main" style="background-color:#55c3f1">主端</label>
            </div>
            <div class="ui-block-b">
            
              <a class="ui-btn ui-corner-all" href="#page_1_1" data-transition="slide" style="background-color:#55c3f1">重置主端密码</a>
              
            </div>
            <div class="ui-block-a">
                <input type="radio" name="login_choose" id="distribution" value="2">
                <label for="distribution" style="background-color:#55c3f1">配货端</label>  
            </div>
            <div class="ui-block-b">
                <input type="radio" name="login_choose" id="delivery" value="3">
                <label for="delivery" style="background-color:#55c3f1">送货端</label> 
            </div>
        </div> 
            	<a class="ui-btn ui-corner-all"  rel="external" onClick="javascript:login();" data-transition="slide" style="background-color:#55c3f1">登陆</a>
</div>
</div>
</div>


<script type="text/javascript">

function setAutoLogin(){
	if($("#auto13").attr("data-cacheval")=="true"){
    localStorage.setItem("isAutoLogin", false);
	}else{
	localStorage.setItem("isAutoLogin", true);
}
}

		function login(){
			if($("#phone_number13").val()=="" || $("#password").val()=="") {
				alert("手机号或密码不能为空！");
				
				return;
			} else if( JKCheckMobile($("#phone_number13")) &&　JKCheckPasswordLogin($("#password")) ){
				var i = $('input[name="login_choose"]:checked').val();
				var authority;
				switch(i)
				{
				  case '1':
				  authority = "main";
				  break;
				  case '2':
				  authority = "distribution"; 
				  break;
				  case '3':
				  authority = "delivery";
				  break;
			
				}
				var pn = $("#phone_number13").val();
				var pw = $("#password").val();
				
				JKStoreLogin(pn, pw, authority); //此函数在JKLogin.js中
			}
		}


 </script>
 
<div id="page_1_1" data-role="page" data-theme="jk">
	<div data-role="header"><a  class="ui-btn ui-corner-all" data-rel="back" data-icon="back">返回</a>
    	<h1 class="ui-corner-all">重置主端密码</h1>
    </div>
    <div data-role="content">
    <div class="ui-field-contain">
      <label for="phone_number2">手机号：</label>
      <input type="text" name="phone_number2" id="phone_number2" placeholder="手机号" value="">
    </div>
      <div class="ui-field-contain">
      <label for="phone_number11">身份证末6位数字：</label>
      <input type="text" id="cardno_last6" placeholder="身份证末6位数字" value="">
    </div>
    <div class="ui-field-contain">
      <input type="text" id="auth_code" placeholder="验证码" value="">
      <a onClick="getVcode(this)">获取短信验证码</a>
    </div>
    <div class="ui-field-contain">
      <label for="password2">设置密码：</label>
      <input type="password" id="password2" placeholder="设置密码" value="">
    </div>
    <div class="ui-field-contain">
      <label for="password2">请再输入一次密码：</label>
      <input type="password" id="repassword2" placeholder="请再输入一次密码" value="">
    </div>
       <p>本软件任何服务费用都将由淘宝专营店收取，不会由任何销售人员代收。</p>
       <p><a class="ui-btn ui-corner-all" onClick="submit11();">设置密码</a></p>
    </div>
</div>
<script type="text/javascript">

function getVcode(obj){
	 var timeout = 60;
            var interValT;
	var tel = $("#phone_number2").val();
	if (tel == '') {
                    alert('请填写手机号');
                } else if (tel.match(/^1[3|4|5|7|8][0-9]\d{8}$/) == null) {
                    alert('请输入正确的手机号');
                } else {
                   $(obj).attr("onClick","");
                   
                    interValT = setInterval(function() {
                        $(obj).html(timeout--+"秒后重新获取");
						if(timeout == 0){
							 window.clearInterval(interValT); 
							timeout = 60;
							 $(obj).html("获取短信验证码");
						$(obj).attr("onClick","getVcode(this)");
						}
                    },
                    1000);
					
JKjsonP({
		ws:"merchants/sendSmsCode",
		parameter:{phoneNumber:tel},
		sFunc:function(json){
			if(json.result == "success"){
			}else{
				alert("短信发送时间，请稍后重试");
			}
		},
		eFunc:function(XMLHttpRequest, textStatus, emessage){
			alert(emessage);
		}
	});
	}
}

     function submit11() {
		 
		 
		var txt = "";
		 if($("#phone_number2").val()=="") {
			txt += "手机号 ";
		 }
		 if($("#cardno_last6").val()=="") {
			txt += "身份证末6位 "; 
		 }
		 if($("#password2").val()=="" || $("#repassword2").val()=="") {
			txt += "密码 ";
		 }
		 if(txt!="") {
			txt += "不能为空！";
			//$("#afui").popup(txt); 
			alert(txt);
		 }
     	 else if(JKCheckMobile($("#phone_number2"))) {
			if(JKCheckCardNoLast6($("#cardno_last6"))) {
				if(JKCheckPasswordSet($("#password2"), $("#repassword2"))) {
					var vcode = $("#auth_code").val();
					
					var mobileno = $("#phone_number2").val();
					JKjsonP({
		ws:"merchants/validateSmsCode",
		parameter:{phoneNumber:mobileno,code:vcode},
		sFunc:function(json){
			if(json.result == "success"){
				var password = $("#password2").val();
					var cnlast6 = $("#cardno_last6").val();
					JKjsonP({
					ws:"merchants/forgetPassword",
					parameter:{username:mobileno, password:password, cardNo:cnlast6},
					sFunc:function(json){
							alert(json.msg);
					},
					eFunc:function(XMLHttpRequest, textStatus, emessage){
						alert(emessage);
					}
				});	
			}else{
				alert(json.msg);
			}
		},
		eFunc:function(XMLHttpRequest, textStatus, emessage){
			alert(emessage);
		}
	});	
				}
			}
		}
     }
	 </script>
</body>
</html>
     

